package org.nekperu15739.aboutme.persistencespring.dao.interfaces.i18n;


import java.util.List;

import org.nekperu15739.aboutme.persistencespring.dto.PersonDTO;
import org.nekperu15739.aboutme.persistencespring.entities.implementation.i18n.PersonEntityJpa;
import org.nekperu15739.aboutme.persistencespring.entities.implementation.i18n.PersonNotFoundException;

/**
 * Declares methods used to obtain and modify person information.
 * @author Petri Kainulainen
 */
public interface PersonService {

    /**
     * Creates a new person.
     * @param created   The information of the created person.
     * @return  The created person.
     */
    public PersonEntityJpa create(PersonDTO created);

    /**
     * Deletes a person.
     * @param personId  The id of the deleted person.
     * @return  The deleted person.
     * @throws PersonNotFoundException  if no person is found with the given id.
     */
    public PersonEntityJpa delete(Long personId) throws PersonNotFoundException;

    /**
     * Finds all persons.
     * @return  A list of persons.
     */
    public List<PersonEntityJpa> findAll();

    /**
     * Finds person by id.
     * @param id    The id of the wanted person.
     * @return  The found person. If no person is found, this method returns null.
     */
    public PersonEntityJpa findById(Long id);

    /**
     * Updates the information of a person.
     * @param updated   The information of the updated person.
     * @return  The updated person.
     * @throws PersonNotFoundException  if no person is found with given id.
     */
    public PersonEntityJpa update(PersonDTO updated) throws PersonNotFoundException;
}
